<template>
  <div class="mod-config">
    <el-table
      :data="dataList"
      border
      v-loading="dataListLoading"
      @selection-change="selectionChangeHandle"
      style="width: 100%;">
      <!-- <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50">
      </el-table-column> -->
      <el-table-column
        fixed
        prop="areaCode"
        header-align="center"
        align="center"
        label="行政区划代码"
        width="120">
      </el-table-column>
      <el-table-column
        fixed
        prop="personalCode"
        header-align="center"
        align="center"
        label="个人编码"
        width="140">
      </el-table-column>
      <el-table-column
        fixed
        prop="name"
        header-align="center"
        align="center"
        label="姓名">
      </el-table-column>
       <el-table-column
        prop="sex"
        header-align="center"
        align="center"
        label="性别">
      </el-table-column>
      <el-table-column
        prop="nation"
        header-align="center"
        align="center"
        label="民族">
      </el-table-column>
      <el-table-column
        prop="politicalFace"
        header-align="center"
        align="center"
        label="政治面目"
        width="120">
      </el-table-column>
      <el-table-column
        prop="idNo"
        header-align="center"
        align="center"
        label="身分证号码"
        width="180">
      </el-table-column>
      <el-table-column
        prop="birthDate"
        header-align="center"
        align="center"
        label="出生年月"
        format="yyyy 年 MM 月 dd 日"
        width="120">
      </el-table-column>
      <el-table-column
        prop="workTime"
        header-align="center"
        align="center"
        label="参加工作时间"
        width="120">
      </el-table-column>
      <el-table-column
        prop="retirementTime"
        header-align="center"
        align="center"
        label="退休时间"
        width="120">
      </el-table-column>
      <el-table-column
        prop="retirementStatus"
        header-align="center"
        align="center"
        label="退休前身份"
        width="180">
      </el-table-column>
      <el-table-column
        prop="duties"
        header-align="center"
        align="center"
        label="职务"
        width="140">
      </el-table-column>
      <el-table-column
        prop="county"
        header-align="center"
        align="center"
        label="所属区县"
        width="140">
      </el-table-column>
      <el-table-column
        prop="street"
        header-align="center"
        align="center"
        label="所属街道"
        width="140">
      </el-table-column>
      <el-table-column
        prop="community"
        header-align="center"
        align="center"
        label="居住社区"
        width="140">
      </el-table-column>
      <el-table-column
        prop="originalTroops"
        header-align="center"
        align="center"
        label="原部队"
        width="140">
      </el-table-column>
      <el-table-column
        prop="handoverPeriod"
        header-align="center"
        align="center"
        label="移交时间段"
        width="140">
      </el-table-column>
      <el-table-column
        prop="handoverTime"
        header-align="center"
        align="center"
        label="移交时间"
        width="140">
      </el-table-column>
      <el-table-column
        prop="handoverMode"
        header-align="center"
        align="center"
        label="移交方式"
        width="140">
      </el-table-column>
      <el-table-column
        prop="handoverBatch"
        header-align="center"
        align="center"
        label="移交批次"
        width="140">
      </el-table-column>
      <el-table-column
        prop="workersClassification"
        header-align="center"
        align="center"
        label="职工分类"
        width="140">
      </el-table-column>
      <el-table-column
        prop="reception"
        header-align="center"
        align="center"
        label="接收情况"
        width="140">
      </el-table-column>
      <el-table-column
        prop="myStatus"
        header-align="center"
        align="center"
        label="本人状态"
        width="140">
      </el-table-column>
      <el-table-column
        prop="inOutTime"
        header-align="center"
        align="center"
        label="转入转出时间"
        width="140">
      </el-table-column>
      <el-table-column
        prop="deathTime"
        header-align="center"
        align="center"
        label="死亡时间"
        width="140">
      </el-table-column>
      <el-table-column
        prop="housingSituation"
        header-align="center"
        align="center"
        label="住房情况"
        width="140">
      </el-table-column>
      <el-table-column
        prop="housingPropertyRight"
        header-align="center"
        align="center"
        label="住房房产权"
        width="140">
      </el-table-column>
      <el-table-column
        prop="leaseholder"
        header-align="center"
        align="center"
        label="租赁人"
        width="140">
      </el-table-column>
      <el-table-column
        prop="housingArea"
        header-align="center"
        align="center"
        label="住房建筑面积"
        width="120">
      </el-table-column>
      <el-table-column
        prop="increasePension"
        header-align="center"
        align="center"
        label="增加退休金"
        width="120">
      </el-table-column>
      <el-table-column
        prop="totalMonthlyPension"
        header-align="center"
        align="center"
        label="本年度月退休金总额"
        width="150">
      </el-table-column>
      <el-table-column
        prop="death"
        header-align="center"
        align="center"
        :formatter="groupFormate"
        label="死亡">
      </el-table-column>
      <el-table-column
        prop="workUnit"
        header-align="center"
        align="center"
        label="工作单位"
        width="300">
      </el-table-column>
      <el-table-column
        prop="address"
        header-align="center"
        align="center"
        label="家庭住址"
        width="300">
      </el-table-column>
      <el-table-column
        prop="phone"
        header-align="center"
        align="center"
        label="电话号码"
        width="300">
      </el-table-column>
      <el-table-column
        prop="remarks"
        header-align="center"
        align="center"
        label="备注"
        width="300">
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        show3: false,
        typeOptions:[],
        retirementStatusList: [],
        myStatusList: [],
        originalTroopsList: [],
        countyList: [],
        streetList: [],
        nameList: [],
        nameListSpirt: [],
        dataForm: {
          key: '',
          street: ''
        },
        dataList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false,
        dataListSelections: [],
        addOrUpdateVisible: false,
      }
    },
    activated () {
      this.getDataList()
      //this.getName()
    },
    created(){
			this.dataSex('DEATH')  
    },

    methods: {
      // 获取数据列表
      getDataList () {
        // alert(this.dataForm.name);
        this.dataListLoading = true
        this.$http({
          url: this.$http.adornUrl('/jxxm/honorableemployees/listRepeat'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.pageIndex,
            'limit': this.pageSize
          })
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list
            this.totalPage = data.page.totalCount
          } else {
            this.dataList = []
            this.totalPage = 0
          }
          this.dataListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },
      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      },
      dataSex(type){
         this.$http({
            url: this.$http.adornUrl("/sys/dict/select/"+type),
            method: "get",
            params: this.$http.adornParams(),
            })
            .then(({ data }) => {
              if(type == 'DEATH'){
                this.typeOptions = data && data.code === 0 ? data.list : [];
              }   
            })
      },
      groupFormate(row) {
				let death = '';
				this.typeOptions.forEach(item => {
					if (row.death == item.code) {
						death = item.value;
					}
				});
				return death;

      }
    }
  }
</script>
